#pragma once

#include "Includes.h"
#include "Constants.h"
#include "CPlane.h"

class CBaseTrace
{
public:

	bool IsDispSurface( void )				{ return ( ( dispFlags & DISPSURF_FLAG_SURFACE ) != 0 ); }
	bool IsDispSurfaceWalkable( void )		{ return ( ( dispFlags & DISPSURF_FLAG_WALKABLE ) != 0 ); }
	bool IsDispSurfaceBuildable( void )		{ return ( ( dispFlags & DISPSURF_FLAG_BUILDABLE ) != 0 ); }
	bool IsDispSurfaceProp1( void )			{ return ( ( dispFlags & DISPSURF_FLAG_SURFPROP1 ) != 0 ); }
	bool IsDispSurfaceProp2( void )			{ return ( ( dispFlags & DISPSURF_FLAG_SURFPROP2 ) != 0 ); }

	inline Entity** HitEntity() { return MakePointerGEN< Entity* >( this, 0x4C ); }

public:
	SD_Tools::Vector			startpos;				// start position
	SD_Tools::Vector			endpos;					// final position
	cplane_t					plane;					// surface normal at impact

	float						fraction;				// time completed, 1.0 = didn't hit anything

	int							contents;				// contents on other side of surface hit
	unsigned short				dispFlags;				// displacement flags for marking surfaces with data

	bool						allsolid;				// if true, plane is not valid
	bool						startsolid;				// if true, the initial point was in a solid area

	CBaseTrace() {}
};
